package com.zheng.study.base.bean.search.rule;

import com.zheng.study.base.bean.search.SearchEnum;

/**
 * 查询 - 参数 - Rule
 * ============================================================================
 * author : fallenpanda
 * createDate:  2018/6/11 。
 * ============================================================================
 */
public abstract class Rule {

	protected final SearchEnum.RuleType ruleType;

	protected Rule(SearchEnum.RuleType ruleType) {
		this.ruleType = ruleType;
	}

	public SearchEnum.RuleType getRuleType() {
		return ruleType;
	}

	public abstract static class Builder<T extends Rule, B extends Builder<T, B>>{

		private B theBuilder;

		protected SearchEnum.RuleType ruleType;

		protected Builder(){
			theBuilder = getThis();
		}

		protected abstract B getThis();

		public B setRuleType(SearchEnum.RuleType ruleType) {
			this.ruleType = ruleType;
			return theBuilder;
		}

		public abstract T build();

	}

}
